package lab02.test23;

import java.util.Scanner;

import java.util.Calendar;

import java.util.GregorianCalendar;

public class Test23 {

    public static void main(String[] args) {

        Calendar time = Calendar.getInstance();
        Calendar time1 = Calendar.getInstance();
        Scanner scanner = new Scanner(System.in);

        int year;
        int month;
        int day;

        System.out.println("年：");
        year = scanner.nextInt();
        System.out.println("月：");
        month = scanner.nextInt();
        System.out.println("日：");
        day = scanner.nextInt();

        time.set(year, month - 1, day);
        int Day = time.get(Calendar.DAY_OF_WEEK);
        System.out.println("星期" + (Day - 1));

        int birthday = time.get(Calendar.DAY_OF_YEAR) - 1;
        int nowtime = time1.get(GregorianCalendar.DAY_OF_YEAR);

        if (birthday < nowtime) {
            System.out.println("距离你的生日还有" + (365 - (nowtime - birthday)) + "天");
        } else if (birthday > nowtime) {
            System.out.println("距离你的生日还有" + (birthday - nowtime) + "天");
        } else {
            System.out.println("生日快乐！");
        }
    }
}

